import BuffUtil from '@/BuffUtil';
import TalentBase from 'code/Scripts/Abilities/base/TalentBase';
const desc = `你的攻击无视闪避,增加${ColorSafe}5%|r的暴击率,但是降低${ColorDanger}50%|r的暴击伤害,当暴击时，在随后的${ColorSafe}3|r秒内增加${ColorSafe}150|r攻速|n觉醒后触发暴击时额外增加${ColorSafe}25%|r吸血`;
const art = 'ReplaceableTextures\\CommandButtons\\BTNCriticalStrike.blp';
const name = '刀刀烈火';
const config: TalentConfigModel = {
    id: 'talent_knive_fire',
    desc,
    art,
    name,
    buffType: {
        id: 'buff_t_knivefire',
        art,
        ubertip: desc,
        name,
        attribute: {
            物理暴击机率: 0.05,
            物理暴击伤害: -0.5,
        },
    },
    buffTypePlus: {
        id: 'buff_t_knivefire_plus',
        art,
        ubertip: `你的攻击无视闪避,增加${ColorSafe}5%|r的暴击率,但是降低${ColorDanger}50%|r的暴击伤害,当暴击时，在随后的${ColorSafe}3|r秒内增加${ColorSafe}150|r攻速|n和${ColorSafe}25%|r吸血`,
        name: '刀刀烈火[觉醒]',
        attribute: {
            物理暴击机率: 0.05,
            物理暴击伤害: -0.5,
        },
    },
};

const effectBuff: AppBuffType = {
    id: 'buff_t_knivefire_ef',
    name,
    ubertip: '增加150攻速',
    art,
    dur: 3,
    targetAttach: 'weapon',
    attribute: {
        attackSpd_p: 1.5,
    },
    targetArt: 'Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl',
};

const effectBuffPlus: AppBuffType = {
    id: 'buff_t_knivefire_plus_ef',
    name,
    ubertip: '增加150攻速和25%攻速',
    art,
    dur: 3,
    targetAttach: 'weapon',
    attribute: {
        attackSpd_p: 1.5,
        物理吸血: 0.25,
    },
    targetArt: 'Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl',
};

export default class TalentKnifeFire extends TalentBase {
    static instance: TalentKnifeFire;
    constructor(p?: TalentConfigModel) {
        super(p);
        TalentKnifeFire.instance = this;
        this.setTalentConfig(config);
        this.init();
        EventManager.受到暴击(this.critedEffect);
    }
    critedEffect(d: DamageEventData) {
        let { unEffect, plus } = TalentKnifeFire.instance.talentUnEffect(d.source);
        if (unEffect) return;
        let id = plus ? effectBuffPlus.id : effectBuff.id;
        BuffUtil.addBuff(d.source, id, d.source);
    }
    init() {
        BuffUtil.registerBuffType(effectBuff);
        BuffUtil.registerBuffType(effectBuffPlus);
    }
}
